package com.zxiw.zxedu.recyclerview.adapter

import android.graphics.Bitmap
import android.graphics.Typeface
import android.graphics.drawable.Drawable
import androidx.recyclerview.widget.RecyclerView


/**
 * @author zhangxiaoming
 * @date 2023/8/18
 * @description adapter规范view操作接口
 */
interface ViewHelper {
    /**
     * 设置textView文本内容
     *
     * @param viewId viewId
     * @param value  文本内容
     * @return viewHolder
     */
    fun setText(viewId: Int, value: String)

    /**
     * 设置imgView的图片,通过Id设置
     *
     * @param viewId   viewId
     * @param imgResId 图片Id
     * @return viewHolder
     */
    fun setImageResource(viewId: Int, imgResId: Int)

    /**
     * 设置背景颜色
     *
     * @param viewId viewId
     * @param color  颜色数值
     * @return viewHolder
     */
    fun setBackgroundColor(viewId: Int, color: Int)

    /**
     * 设置背景颜色
     *
     * @param viewId   viewId
     * @param colorRes 颜色Id
     * @return viewHolder
     */
    fun setBackgroundColorRes(viewId: Int, colorRes: Int)

    /**
     * 设置textView文本颜色
     *
     * @param viewId viewId
     * @param color  颜色数值
     * @return viewHolder
     */
    fun setTextColor(viewId: Int, color: Int)

    /**
     * 设置textView文本颜色
     *
     * @param viewId   viewId
     * @param colorRes 颜色Id
     * @return viewHolder
     */
    fun setTextColorRes(viewId: Int, colorRes: Int)

    /**
     * 设置img的Drawable
     *
     * @param viewId   viewId
     * @param drawable drawable
     * @return viewHolder
     */
    fun setImageDrawable(viewId: Int, drawable: Drawable)

    /**
     * 设置img的Drawable
     *
     * @param viewId      viewId
     * @param drawableRes drawableId
     * @return viewHolder
     */
    fun setImageDrawableRes(viewId: Int, drawableRes: Int)

    /**
     * 设置img图片路径
     *
     * @param viewId viewId
     * @param imgUrl 图片路径
     * @return viewHolder
     */
    fun setImageUrl(viewId: Int, imgUrl: String)

    /**
     * 设置img图片Bitmap
     *
     * @param viewId    viewId
     * @param imgBitmap imgBitmap
     * @return viewHolder
     */
    fun setImageBitmap(viewId: Int, imgBitmap: Bitmap)

    /**
     * 设置控件是否隐藏
     *
     * @param viewId  viewId
     * @param visible visible
     * @return viewHolder
     */
    fun setVisible(viewId: Int, visible: Boolean)

    /**
     * 设置控件的tag
     *
     * @param viewId viewId
     * @param tag    tag
     * @return viewHolder
     */
    fun setTag(viewId: Int, tag: Any)

    /**
     * 设置控件tag
     *
     * @param viewId viewId
     * @param key    tag的key
     * @param tag    tag
     * @return viewHolder
     */
    fun setTag(viewId: Int, key: Int, tag: Any)

    /**
     * 设置Checkable控件的选择情况
     *
     * @param viewId  viewId
     * @param checked 选择
     * @return viewHolder
     */
    fun setChecked(viewId: Int, checked: Boolean)

    /**
     * 设置RecyclerView的Adapter
     *
     * @param viewId  viewId
     * @param adapter adapter
     * @return viewHolder
     */
    fun setAdapter(viewId: Int, adapter: RecyclerView.Adapter<*>)

    /**
     * 设置控件透明效果
     *
     * @param viewId viewId
     * @param value  透明值
     * @return viewHolder
     */
    fun setAlpha(viewId: Int, value: Float)

    /**
     * 设置textView正则
     *
     * @param viewId
     * @return viewHolder
     */
    fun linkify(viewId: Int)

    /**
     * 设置TextView字体
     *
     * @param viewId   viewId
     * @param typeface typeface
     * @return viewHolder
     */
    fun setTypeface(viewId: Int, typeface: Typeface)

    /**
     * 设置多个TextView字体
     *
     * @param typeface typeface
     * @param viewIds  viewId组合
     * @return viewHolder
     */
    fun setTypeface(typeface: Typeface, vararg viewIds: Int)

    /**
     * 设置ProgressBar控件进度
     *
     * @param viewId   viewId
     * @param progress progress
     * @return viewHolder
     */
    fun setProgress(viewId: Int, progress: Int)

    /**
     * 设置ProgressBar控件进度
     *
     * @param viewId   viewId
     * @param progress progress
     * @param max      max
     * @return viewHolder
     */
    fun setProgress(viewId: Int, progress: Int, max: Int)

    /**
     * 设置ProgressBar控件最大进度值
     *
     * @param viewId viewId
     * @param max    max
     * @return viewHolder
     */
    fun setMax(viewId: Int, max: Int)

    /**
     * 设置评分控件
     *
     * @param viewId viewId
     * @param rating 评分
     * @return viewHolder
     */
    fun setRating(viewId: Int, rating: Float)

    /**
     * 设置评分控件
     *
     * @param viewId viewId
     * @param rating 评分
     * @param max    最大
     * @return viewHolder
     */
    fun setRating(viewId: Int, rating: Float, max: Int)
}